<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="../vue-2.4.0.js"></script>
    <style>
      /* .first {
        color: red;
      }

      .second {
        font-size: 25px;
      } */
    </style>
  </head>
  <body>
    <!-- 内联样式 -->
    <div id="add">
     <!-- 插值表达式，可以读取我们的变量 -->
        <!-- !!!键如果包含-的话，我们必须要加上引号 -->
        <div :style="{'font-size':'32px'}">{{message}}</div>
        <div :style="textStyle">{{message}}</div>
        <div :style="[textStyle,textStyle2]">{{message}}</div>
        <div :style="getStyle(2)">{{message}}</div>
       
    </div>
  </body>
  <script>
    let ve = new Vue({
        el:"#add",
        data: {
                message: 'Hello Vue!',
                textStyle: {
                    color: 'red',
                    'font-size': '50px'
                },
                textStyle2: {
                    'font-weight': '600'
                }
            },
            methods: {
                getStyle(num) {
                    let obj = {
                        color: 'red',
                        'font-size': '50px'
                    };
                    if (num == 1) {
                        obj.color = 'red'
                    } else {
                        obj.color = 'green'
                    }
                    return obj
                }
            }
    }); 

  </script>
</html>
